import com.dimbottom.dao.StudentDao;
import com.dimbottom.util.H2Utils;

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

public class InitClass {
    public static void main(String[] args) throws SQLException {
        Connection connection = H2Utils.getConnection();
        Statement statement = connection.createStatement();
        statement.execute("DROP TABLE IF EXISTS student;");
        statement.execute("CREATE TABLE student\n" +
                "(\n" +
                "    student_code VARCHAR NOT NULL,\n" +
                "    CONSTRAINT STUDENT_PK\n" +
                "        Primary Key (student_code)\n" +
                ");");
        statement.close();
        connection.close();
        StudentDao studentDao = new StudentDao();
        studentDao.InsertStudentCode("");// 插入学号
        List<String> strings = studentDao.queryAllStudentCode();
        strings.forEach(System.out::println);
    }
}
